package com.example.app;


import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class SectoresArrayAdapter extends ArrayAdapter <Sectores> {

	
	Context contexto;
	ArrayList<Sectores> todosSectores;
	public SectoresArrayAdapter(Context context, int textViewResourceId,
			List<Sectores> sectores) {
		super(context, textViewResourceId,sectores);
		// TODO Auto-generated constructor stub
		contexto = context;
		todosSectores = (ArrayList<Sectores>) sectores;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater constructor = ((Activity) contexto).getLayoutInflater();
		View item = constructor.inflate(R.layout.adpater_pregunta1, null);

		TextView tv_sector = (TextView) item.findViewById(R.id.tv_pregunta2);
		tv_sector.setText(todosSectores.get(position).getSector());

		ImageView iv_imagen = (ImageView) item.findViewById(R.id.imageView1);
		iv_imagen.setImageResource(todosSectores.get(position).getImagen());

		return item;
		
	
	}
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return getView(position, convertView, parent);
	}

	
	
	
	
	
	
	
	
	
	
}
